home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Amos / AMOSList-0497 / AMOSLIST / text0181.txt < prev    next >
Encoding:
Text File  |  1998-06-24  |  2.7 KB  |  64 lines

  1. > Ive managed to get a copy of devPac, and am not sure on how to integrate any
  2. > kind of assembler into AMOS. Someone did explain the basics of Dreg to me,
  3. > but I still dont quite get it.
  4.  
  5. It's basically very simple. You first need to code something in PC-relative
  6. code. That means that stuff like jsr and jmp are out of the question; in-
  7. structions like 'lea Data, a3' should be coded as 'lea Data(pc), a3'. If
  8. you neglect these requirements you'd better make sure you have your ticket
  9. to India handy. Your code should also be one segment. Finally, Devpac is
  10. not capable of writing out raw code, it always wraps a set of hunks around
  11. your code. You need to remove these hunks manually before you load the code
  12. into AMOS. (It's not hard, if you stick to PC-relative code and 1 code
  13. segment, you just need to remove the first 32 bytes and the last 4 bytes.)
  14.  
  15. Of course, you can circumvent these problems, but then you need to call
  16. on LoadSeg() to load your code into memory. I have never tried this, but
  17. I see no reason why this should fail. 
  18.  
  19. Lets assume an example:
  20.  
  21.     addq.l #8, d1
  22.      rts
  23.  
  24. This code adds 8 to the register d1. You can Poke the code into memory your-
  25. self, it's just four bytes. I've assumed this is done in bank 10. Next you
  26. program in AMOS:
  27.  
  28.     Dreg(1)=100
  29.     Call Start(10)
  30.     RESULT=Dreg(1)    
  31.  
  32. which should yield 108 as the answer. I've forgotten whether 'call' is the
  33. right instruction, but you probably get the idea. First you setup d1 to
  34. contain 100, then you call your small program. That simply adds 8 to what-
  35. ever is stored in d1, and then returns. AMOS then reads what is inside
  36. d1 -- 108. 
  37.  
  38. Using this technique, I've written a small program which converts AMOS'
  39. FFP numbers into IEEE-compliant ones; I could then use my FPU from within
  40. AMOS 1.36. It's not easy to do (AMOS Pro solved this problem on a much
  41. better level) but it worked!
  42.  
  43. > Can someone send me an ASM program, which can be merged into AMOS, and
  44. > explain to me how to use it. I would like to write an ASM version of ZOOM,
  45. > and would be interested in routines which will draw onto the screen, or draw
  46. > to mem for a c2p routine.
  47.  
  48. There are plenty of asm-c2p routines available on Aminet; if you change
  49. the screen base to point to the memory region where AMOS stores the bitplanes
  50. you're in business. I believe it's Screen Base or Phybase which gives you
  51. the required addresses. There was a special demo on the Amos Classic Compiler
  52. disk illustrating a certain effect programmed with ML. You should take a look
  53. at this.
  54.  
  55. However, if you are not familiar with assembly language, I'd advise you to
  56. study that first. There is no point in messing with it if you don't know
  57. the limitations and possibilities.
  58.  
  59. Hope this helps a bit,
  60. Maarten
  61.  
  62.  
  63.